{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "61fa24ef",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time\n",
    "import random\n",
    "from selenium.webdriver.common.by import By\n",
    "from selenium.webdriver import ActionChains\n",
    "from selenium import webdriver\n",
    "from dotenv import load_dotenv\n",
    "import os"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b0c943a6",
   "metadata": {},
   "source": [
    "# 学习通"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "52d34751",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我已阅读并同意学习通《隐私政策》和《用户协议》\n"
     ]
    }
   ],
   "source": [
    "driver = webdriver.Edge()\n",
    "driver.get(\"https://passport2.chaoxing.com/login?fid=12&refer=http%3A%2F%2Fi.chaoxing.com%2Fbase%3Ft%3D1665462313108&space=2\")\n",
    "\n",
    "def simulate_sendkeys(label,str1):\n",
    "    label.clear()\n",
    "    time.sleep(0.3)\n",
    "    for i in str1:\n",
    "        time.sleep(random.random())\n",
    "        label.send_keys(i)\n",
    "        \n",
    "load_dotenv()\n",
    " \n",
    "a = driver.find_element(By.XPATH,\"/html/body/div[1]/div[1]/div[2]/div[2]/form/div[1]/input\")\n",
    "simulate_sendkeys(a,\"13630165657\")\n",
    "\n",
    "b = driver.find_element(By.XPATH,\"/html/body/div[1]/div[1]/div[2]/div[2]/form/div[2]/input\")\n",
    "simulate_sendkeys(b,os.getenv(\"XueXiTong\"))\n",
    "\n",
    "from selenium.webdriver import ActionChains\n",
    "xxx = ActionChains(driver)\n",
    "\n",
    "c = driver.find_element(By.XPATH,\"/html/body/div[1]/div[1]/div[2]/div[2]/form/div[3]\")\n",
    "xxx.click(c).perform()\n",
    "\n",
    "d = driver.find_element(By.XPATH,\"/html/body/div[1]/div[1]/div[2]/div[2]/p[2]\")\n",
    "print(d.text)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf5dfc6c",
   "metadata": {},
   "source": [
    "# 点宽"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "41dd8999",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "从高校到企业，从理论到实践的最后一公里\n"
     ]
    }
   ],
   "source": [
    "driver = webdriver.Edge()\n",
    "driver.get(\"https://www.digquant.com/account\")\n",
    "\n",
    "def simulate_sendkeys(label,str1):\n",
    "    label.clear()\n",
    "    time.sleep(0.3)\n",
    "    for i in str1:\n",
    "        time.sleep(random.random())\n",
    "        label.send_keys(i)\n",
    "        \n",
    "load_dotenv()\n",
    "    \n",
    "a = driver.find_element(By.XPATH,\"/html/body/div[1]/div[2]/div[1]/div/div[2]/div/div[2]/form/div[1]/div/div/div/input\")\n",
    "simulate_sendkeys(a,\"13630165657\")\n",
    "\n",
    "b = driver.find_element(By.XPATH,\"/html/body/div[1]/div[2]/div[1]/div/div[2]/div/div[2]/form/div[2]/div/div/div/input\")\n",
    "simulate_sendkeys(b,os.getenv(\"DigQuant\"))\n",
    "\n",
    "xxx = ActionChains(driver)\n",
    "c = driver.find_element(By.XPATH,\"/html/body/div[1]/div[2]/div[1]/div/div[2]/div/div[2]/form/div[3]\")\n",
    "xxx.click(c).perform()\n",
    "\n",
    "d = driver.find_element(By.XPATH,\"/html/body/div[1]/div[2]/div[1]/div/div[2]/div/div[1]/div\")\n",
    "print(d.text)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2c6928c5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
